<template>
  <div>
    <button @click="onClick($event)">按钮1</button>
    <button @click="onClick">按钮2</button>
    <!-- 这种方式获取不到事件 -->
    <button @click="onClick()">按钮3</button>

    <!-- .sync 父子组件共享值 -->
    <child :value.sync="value" :text.sync="text" @update:value="updateValue"/>
    {{value}} -- {{text}}
  </div>
</template>
<script>

import Child from '@/views/form/components/Child.vue'

export default {
  components: { Child },

  data() {
    return {
      value: '',
      text: ''
    }
  },
  methods: {
    onClick(e) {
      console.log('获取事件', e)
    },
    updateValue(value) {
      console.log(value)
    }
  }
}
</script>
